﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DotNetNinjaLibrary.Basics;

namespace DotNetNinjaLibrary
{
	public class BadGuy : Unit
	{
		public BadGuy(Size size)
			: base(size)
		{
			this.Speed = TimeSpan.FromMilliseconds(100).Ticks;
		}

		public Unit HeroToTrack { get; set; }

		private Point lastHeroLocation;

		protected override void OnUpdated(long gameTime)
		{
			var pos = HeroToTrack.Location;
			var target = new Point(pos.X + 1, pos.Y);

			if (pos != lastHeroLocation)
			{
				lastHeroLocation = pos;
				this.GoTo(target);
			}
			
			base.OnUpdated(gameTime);
		}

		public override string Model
		{
			get { return "Hunchback"; }
		}
	}
}
